// Copyright (c) 2011 The Kiwii Authors. All rights reserved.
// Use of this source code is governed by the New BSD License that can be
// found in the LICENSE file. See the AUTHORS file for names of contributors.

#ifndef _OPERATION_HXX_
#define _OPERATION_HXX_

#include "comm/Protocol.hxx"
#include "backend/Db.hxx"
#include <boost/pool/detail/singleton.hpp>
#include <map>
#include <string>

namespace kiwii {

  typedef comm::protocol::Reply (*Operation)(DB* db, comm::protocol::Request const& request);

  //Collection of operations.
  class Operations {
  public:
    Operation get(std::string const&) { return nullptr; }

  private:
    Operations() {}

    std::map<std::string, Operation> ops_;

    template <typename T>
    friend class boost::details::pool::singleton_default;
  };

  typedef boost::details::pool::singleton_default<Operations> OperationFactory;
}

#endif
